﻿using Microsoft.EntityFrameworkCore;
using mozhi.smarterp.Business.Inventories;
using mozhi.smarterp.Business.Products;
using mozhi.smarterp.Business.Purchases;
using mozhi.smarterp.Business.Sales;
using Mozhi.Abp.Module.DataLinkage;
using Mozhi.Abp.Module.DataLinkage.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;

namespace mozhi.smarterp.Business.EntityFrameworkCore;

[ConnectionStringName(BusinessDbProperties.ConnectionStringName)]
public class BusinessDbContext : AbpDbContext<BusinessDbContext>, IBusinessDbContext , IDataLinkageDbContext
{
    /* Add DbSet for each Aggregate Root here. Example:
     * public DbSet<Question> Questions { get; set; }
     */

    #region
    public DbSet<DataLinkage> DataLinkages { get; set; }
    #endregion

    public DbSet<InventoryRealTime> InventoryRealTimes { get; set; }

    public DbSet<ProductInventorySetting> ProductInventorySettings { get; set; }

    public DbSet<ProductPurchaseSetting> ProductPurchaseSettings { get; set; }

    public DbSet<PurchaseRequisition> purchaseRequisitions { get; set; }

    public DbSet<PurchaseOrder> PurchaseOrders { get; set; }

    public DbSet<PurchaseRequisitionOrder> PurchaseRequisitionOrders { get; set; }

    public DbSet<PurchaseReceipt> PurchaseReceipts { get; set; }

    public DbSet<PurchaseOrderReceipt> PurchaseOrderReceipts { get; set; }

    public DbSet<PurchaseProductPrice>  PurchaseProductPrices { get; set; }

    public DbSet<SaleProductPrice> SaleProductPrices { get; set; }

    public DbSet<SaleQuotation> SaleQuotations { get; set; }

    public BusinessDbContext(DbContextOptions<BusinessDbContext> options)
        : base(options)
    {

    }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);

        builder.ConfigureBusiness();
        builder.ConfigureDataLinkage();
    }
}
